:: Check if we are coming from a reboot
IF EXIST %systemDrive%\reboot.tag GOTO :SP2010

:: Pre-Requisites Install. This will take care of App server roles
Start /w PrerequisiteInstaller
Start /w NDP35SP1-KB976126-v2-x64.exe /q /norestart
Start /w wusa.exe /quiet /norestart PrerequisiteInstallerFiles\Windows6.0-KB976394-x64.msu

GOTO :Reboot

:SP2010
::SP2010 Setup
Start /w %~dp0Setup.exe /Config config.XML
del %systemdrive%\reboot.tag
GOTO :END

:Reboot
::Add the runOnce registry key and reboot
echo rebootcheck > %SystemDrive%\reboot.tag
reg add HKEY_LOCAL_MACHINE\SOFTWARE\Microsoft\Windows\CurrentVersion\RunOnce /v SP2010Installer /d %~dp0%0
shutdown -r -t 10

:END
exit